package br.com.jsfprimefaces.util;

import org.hibernate.SessionFactory;
import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
import org.hibernate.cfg.Configuration;
import org.hibernate.service.ServiceRegistry;


public class BancoUtil {

	private static SessionFactory factory;
	
	static{
		Configuration configuration = new Configuration().configure();
		StandardServiceRegistryBuilder serviceRegistryBuilder = new StandardServiceRegistryBuilder().applySettings(configuration.getProperties());
		ServiceRegistry serviceRegistry = serviceRegistryBuilder.build();
		
		factory = configuration.buildSessionFactory(serviceRegistry);
	}

	public static SessionFactory getFactory(){
		return factory;
	}

}
